package com.itheima.manager;

import com.itheima.domain.PmsSkuStock;
import com.itheima.service.PmsSkuStockService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
@Component
public class PmsSkuStockManager {

    @DubboReference
    public PmsSkuStockService pmsSkuStockService;
    
    
    public void updateSku(Integer pid, List<PmsSkuStock> pmsSkuStocks) {
        for (PmsSkuStock pmsSkuStock : pmsSkuStocks) {
            pmsSkuStock.setProductId((long)pid);
            pmsSkuStockService.updateById(pmsSkuStock);
        }
    }

    public List<PmsSkuStock> getSku(Integer pid, String keyword) {
        return pmsSkuStockService.getSku(pid,keyword);
    }
}
